<?php
/*
 * Establishes the connection and hold the single instance.
 * 
 * Loads the database configuration and provides a connection.
 * 
 */

m2import('dba/udba.o.inc.php');

class dba_DataSource
{
    
    var $dba;
    
    function dba_DataSource()
    {
        include($GLOBALS['cfgPaths']['etcPath']."dbconf.inc.php");
        $this->dba = new udba($dbase,$dbhost,$dbusr,$dbpass,$tableforwarder);
    }

    /**
     * static factory method
     *
     * @staticvar dba_DataSource $obj
     * @return dba_DataSource Datasource singleton
     */
    function & getInstance()
    {
        static $obj = null;
        if ($obj == null)
            $obj = new dba_DataSource();
        return $obj;
    }

    /**
     *
     * @return udba Database abstraction
     */
    function & getConnection()
    {
        return $this->dba;
    }

}

?>
